<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
		<script src="https://cdn.jsdelivr.net/npm/vue"></script>
		<title></title>
	</head>
	<body>
		<div id="app">
			<p> Using mustache: {{msg}}</p>
			<p> Using v-html: <span v-html="msg"></span></p>
		</div>
		<div id="app2">
			<template v-if="loginType === 'username'">
			  <label>Username</label>
			  <input placeholder="Enter your username" key='input-username'>
			</template>
			<template v-else>
			  <label>Email</label>
			  <input placeholder="Enter your email address" key='input-email'>
			</template>	
			<button @click="toggle">转换</button>
		</div>

			</body>
	<script>
		var app = new Vue({
			el: '#app',
			data: {
				msg: "<span style='color:red'>hehe</span>"
			}
		})
		var app2 = new Vue({
			el: '#app2',
			data: {
				loginType: 'username'
			},
			methods: {
				toggle: function() {
					if (this.loginType === 'username') {
						this.loginType = 'email';
					} else {
						this.loginType = 'username';
					}
					
				}
			}
		})
	</script>
</html>
